function Pue(data) {
  this._data = data;

  this._createElements();
};

Pue.prototype._createElements = function() {
  var _self = this;

  // Data
  var folder = (this._data && this._data.folder) ? this._data.folder : null;
  var instance_id = (this._data && this._data.instance_id) ? this._data.instance_id : null;
  var images = (this._data && this._data.images) ? this._data.images : [];

  var unique = folder + '_' + instance_id + '_';
  // Gui
  this._gui = {};
  this._gui.image = document.getElementById(unique + 'uploaded');

  var table, tr, td, img;
  table = document.createElement('table');
  table.style.marginTop = '10px';
  table.style.marginBottom = '80px';
  this._gui.image.appendChild(table);

  tr = table.insertRow(-1);
  if (images.length > 0) {
    td = tr.insertCell(-1);
    td.width = '120px';
    size = MiscUtils.decrease( [ images[0].width, images[0].height ], [ 100, 100 ]);
    img = document.createElement('img');
    img.width = size[0];
    img.height = size[1];
    img.src = 'http://{{$smarty.const.DOMAIN|escape:'javascript'}}{{$smarty.const.PATH|escape:'javascript'}}' + 'plugins/' + folder + '/' + images[0].link;
    td.appendChild(img);
    td = tr.insertCell(-1);
    td.appendChild(document.createTextNode('Replace It'));
    td.appendChild(document.createElement('br'));
  } else {
    td = tr.insertCell(-1);
    td.width = '120px';
    td = tr.insertCell(-1);
    td.appendChild(document.createTextNode('Upload One Icon'));
    td.appendChild(document.createElement('br'));
  }

  var browse = document.createElement('span');
  var cancel = document.createElement('span');
  browse.id = unique + UploadUtils._defaultButtonPlaceholderId;
  cancel.id = unique + UploadUtils._defaultCancelButtonId;
  td.appendChild(browse);
  td.appendChild(cancel);

  var pos = DOMUtils.findPos(browse);
  var up = null;
  var initFunc = function() {
    var div = document.createElement('div');
    var p = new ModulePopupBox();
    p._open(div, {
      pos : [ pos[0] + 100, pos[1] - 260 ],
      width : 468,
      t : '',
      doc : document
    });
    up = new ModuleUpload(document, div, 468, 260, _self._user, _self._date, {
      u : unique,
      callbackFunc : function() {
        location.reload()
      },
      popupBox : p
    });
  };

  var uu = new UploadUtils(unique);
  uu._fileUploadLimit = 1;
  uu._uploadUrl = 'plugins/' + folder + '/upload.php';
  uu._buttonImageUrl = 'image/upload/browse.png';
  uu._buttonWidth = 94;
  uu._buttonHeight = 29;
  uu._createInstance(instance_id + '/', {
    instance_id : instance_id,
    id : ((images.length > 0) ? images[0].id : 0),
    link : ((images.length > 0) ? images[0].link : '')
  }, initFunc, function(file, result) {
    up._callbackFunc(file, result);
  });

};
